
<template>
  <base-page-view class-name="page-container confirmDetails">
    <view v-if="listData.length>0" class="confirmDetailsContent">
      <view class="confirmDetailsHead">
        <view>合计收益：¥{{ monthTotal | formatMoney }}</view>
      </view>
      <view v-for="(list,index) in listData" :key="index" class="list">
        <view v-for="(goods,index2) in list.goodsList" :key="index2" class="goods">
          <view class="title" :class="goods.reward>=0?'':'title_pri_del'">{{ goods.title }}</view>
          <view class="goodsRight"><view class="num">*{{ goods.num }}</view> <view>¥{{ goods.reward | formatMoney }}</view></view>
        </view>
        <view class="totalEarnings">总收益¥{{ list.rewardTotal | formatMoney }}</view>
        <view class="c_border"></view>
        <view class="order">
          <view class="details">
            <view>购买人：</view>
            <view>{{ list.buyer }}</view>
          </view>
          <view class="details">
            <view>订单编号：</view>
            <view>{{ list.orderNo }}</view>
          </view>
          <view class="details">
            <view>订单金额：</view>
            <view>¥{{ list.total | formatMoney }}</view>
          </view>
          <view class="details">
            <view>付款时间:</view>
            <view>{{ list.payTime }}</view>
          </view>
        </view>
      </view>
    </view>
    <view v-if="listData.length<1" class="empty_view">
      <image src="/static/images/commission/commission-empty.png" class="empty_img" />
      <view class="tit">暂无任何内容</view>
    </view>
    <view v-if="nomore&&listData.length>0" class="nomore">暂无更多数据~</view>
  </base-page-view>
</template>

<script>
import './confirmDetails.scss'
export default {
  components: {
  },
  data() {
    return {
      pageSize: 10,
      pageNo: 1,
      listData: [],
      monthTotal: '',
      nomore: false,
      orderStatus: 0
    }
  },
  created() {
  },
  onLoad(option) {
    console.log(option)
    this.orderStatus = option.orderStatus
    this.monthTotal = option.totalMoney
    this.getList()
  },
  onPullDownRefresh() {
    this.pageNo = 1
    this.listData = []
    this.nomore = false
    this.getList()
  },
  onReachBottom() {
    if (this.nomore) return
    this.pageNo += 1
    this.getList()
  },
  onShow() {
  },
  methods: {
    async getList() {
      const res = await this.$api.commissionApi.listUserUnWithdrawCommission({
        userId: this.$store.state.userInfo.uid,
        pageSize: this.pageSize,
        pageNo: this.pageNo,
        orderStatus: this.orderStatus
      })
      if (res.code === '000000') {
        setTimeout(function() {
          uni.stopPullDownRefresh()
        }, 500)
        this.listData = this.listData.concat(res.data.orderList)
        if (res.data.orderList.length < this.pageSize) {
          this.nomore = true
        }
      }
    }
  }
}
</script>
